import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tiktokadult/hj_model/cartoon_media_info.dart';
import 'package:tiktokadult/hj_page/find/rank_module/video_rank_cell.dart';
import 'package:tiktokadult/tools_base/widget/net_image_widget.dart';

import '../../../routers/jump_router.dart';

//图集排行榜item
class ACGRankItem extends StatelessWidget {
  final int index;
  final CartoonMediaInfo? movie;

  const ACGRankItem(
    this.index,
    this.movie,
  );

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        pushToCartoonPage(movie);
      },
      child: Container(
        height: 108,
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            SizedBox(
              width: 80,
              height: 108,
              child: NetworkImageLoader(
                imageUrl: movie?.coverV ?? '',
                borderRadius: 8,
              ),
            ),
            SizedBox(width: 10),
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: [
                  Row(
                    children: [
                      Image.asset(rankImgPath(index), width: 24),
                      SizedBox(width: 4),
                      Text(
                        "NO.${index + 1}",
                        style: TextStyle(
                          color: rankColor(index),
                          fontSize: 14,
                        ),
                      ),
                    ],
                  ),
                  Text(
                    "${movie?.title ?? ''}",
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                    style: TextStyle(
                      color: Color(0xE5FFFFFF),
                      fontSize: 12,
                      height: 1.5,
                    ),
                  ),
                  Text(
                    '${movie?.episodeNumberStatus ?? ''} · ${movie?.getUpdateString}',
                    textAlign: TextAlign.left,
                    style: TextStyle(fontSize: 11, color: _statusColor, fontWeight: FontWeight.w400),
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

  Color get _statusColor {
    return movie?.updateStatus == 1 ? Color(0xffEEC76B) : Colors.white.withOpacity(.45);
  }
}
